//
//  AViewController.swift
//  自定义tabbar和navigationbar
//
//  Created by lete on 2020/4/24.
//  Copyright © 2020 lete. All rights reserved.
//

import UIKit

class AViewController: UIViewController {
    
    var message: NSString?
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
        view.backgroundColor = UIColor.red
        title = "A"
        
        self.view.backgroundColor = UIColor.white
        initBtn()
        print(message as Any)
        
    }
    
    //初始化返回按钮，点击按钮返回主页面。
    func initBtn() {
        let screenSize = UIScreen.main.bounds.size
        let jumpBtn = UIButton(type: .system)
        jumpBtn.setTitle("返回", for: .normal)
        jumpBtn.frame = CGRect(x: screenSize.width / 2 - 50, y: screenSize.height/4 - 50, width: 100, height: 30)
        jumpBtn.backgroundColor = UIColor(red: 50 / 255, green: 123 / 255, blue:  255 / 255, alpha: 1)
        jumpBtn.setTitleColor(UIColor.white, for: .normal)
        //按钮绑定事件
        jumpBtn.addTarget(self, action: #selector(pageReturn), for: .touchDown)
        self.view.addSubview(jumpBtn)
    }
    
    
    @objc func pageReturn() -> Void {
        //返回主页面
        self.dismiss(animated: true, completion: nil)
    }
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destination.
     // Pass the selected object to the new view controller.
     }
     */
    
}
